<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<html lang="en" style="height: 100%">
<head>
    <title th:text="${configModel.document.title}"></title>
    <meta charset="UTF-8">
    <!-- 网站显示页logo图标 -->
    <link rel="shortcut icon" th:href="@{/static/favicon.ico}">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <script type="text/javascript" th:src="@{/static/js/jquery-2.1.3.min.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/static/css/bootstrap.min.css}"/>
    <script type="text/javascript" th:src="@{/static/js/bootstrap.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/codehandle.js}"></script>
    <style type="text/css">
        html,body{
            height:100%;
            width:100%;

        }
    </style>

</head>
<body>
<div id="placeholder" class="nav" style="width: 100%; height: 100%"></div>
<script type="text/javascript" th:src="${configModel.officeApiUrl}"></script>
<script th:inline="javascript">

    var onAppReady=function (){
        console.log("onAppReady")
    }
    var onDocumentStateChange=function (e){
        console.log("onDocumentStateChange",e)
    }
    var onError=function (e){
        console.log("onError",e)
    }

    initDoc([[${configModel}]])
    function initDoc(configModel) {
        let config = {
            "type": configModel.type,
            "width": "100%",
            "height": "100%",
            "documentType": configModel.documentType,
            "document": {
                "fileType": configModel.document.fileType,//文档类型
                "key": configModel.document.key,//定义用于服务识别文档的唯一文档标识符。每次编辑和保存文档时，都必须重新生成密钥。长度限制为128个符号。
                "title": configModel.document.title,//为查看或编辑的文档定义所需的文件名，该文件名也将在下载文档时用作文件名。长度限制为128个符号。
                "url": configModel.document.url,//定义存储原始查看或编辑的文档的绝对URL
            },
            "editorConfig":{
                "lang": "zh-CN",//语言环境 en:英语 zh-CN：中文
                "mode": configModel.editorConfig.mode,//文档操作模式 view 视图模式不可编辑  edit 编辑模式可编辑文档
                "callbackUrl": configModel.editorConfig.callbackUrl,  //保存文件时的回调地址
                "customization":{
                    "forcesave":false,
                    "zoom": 100,
                },
                "user": {
                    "id": configModel.editorConfig.userId,//用户ID
                    "name": configModel.editorConfig.username//用户全名称
                }
            },
        };
        console.log("config",config)
        let docEditor = new DocsAPI.DocEditor("placeholder", config);
    }
</script>
</body>
</html>
